package cn.com.css.taxInspection.gt3.service.impl;

import cn.com.css.taxInspection.gt3.entity.*;
import cn.com.css.taxInspection.gt3.mapper.ZbcxMapper;
import cn.com.css.taxInspection.gt3.service.ZbcxService;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service("ZbcxService")
public class ZbcxServiceImpl extends ServiceImpl<ZbcxMapper, ZbcxEntity> implements ZbcxService {

    @Resource
    private ZbcxMapper zbcxMapper;

    @Override
    public Map<String, Object> queryZbcxTable(ZbcxEntity zbcxEntity) {
        int page = zbcxEntity.getPage();
        int pageSize = zbcxEntity.getPageSize();
        int offset = (page - 1) * pageSize;
        String zb = zbcxEntity.getZb(); // 假设 zb 是 int 类型
        List<FybhlEntity> fybhlEntityList;
        List<MllzbEntity> mllzbEntityList;
        List<QjfylEntity> qjfylEntityList;
        List<SrbhlEntity> srbhlEntityList;
        Map<String, Object> result = new HashMap<>();
        switch (zb) {
            case "1":
                fybhlEntityList = zbcxMapper.queryFybhlTable(zbcxEntity);
                result.put("data", fybhlEntityList);
                break;
            case "2":
                mllzbEntityList = zbcxMapper.queryMllzbTable(zbcxEntity);
                result.put("data", mllzbEntityList);
                break;
            case "3":
                qjfylEntityList = zbcxMapper.queryQjfylTable(zbcxEntity);
                result.put("data", qjfylEntityList);
                break;
            case "4":
                srbhlEntityList = zbcxMapper.querySrbhlTable(zbcxEntity);
                result.put("data", srbhlEntityList);
                break;
            default:
                throw new IllegalArgumentException("无效的 zb 值: " + zb);
        }
//        result.put("total", total);
        return result;
    }
}